﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
/// <summary>
/// Descripción breve de conexion
/// </summary>
public class conexion
{
		MySqlConnection mycon;
        public String conexion_app()
        {
            return ConfigurationManager.ConnectionStrings["PruebasConnectionString"].ToString();
        }
        public void openConexion()
        {
            try
            {
                mycon = new MySqlConnection(conexion_app());
                mycon.Open();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public void cerrarConexion()
        {
            mycon.Close();
        }
        public MySqlDataReader oSeleccion(String instruccion)
        {
            MySqlCommand com = new MySqlCommand(instruccion, mycon);
            return com.ExecuteReader();
        }
    public void CreateMySqlCommand(string myExecuteQuery)
    {
        MySqlCommand myCommand = new MySqlCommand(myExecuteQuery,mycon);
        myCommand.ExecuteNonQuery();
        mycon.Close();
    }
}
